package com.turing.pre.processor.enums;

import lombok.Getter;

public enum FileTypeEnum {

    PDF(0, "pdf"),
    DOC(1, "doc"),
    DOCX(2, "docx"),
    XLS(3, "xls"),
    PNG(4, "png"),
    JPG(5, "jpg"),
    TXT(6, "txt"),
    TIF(7, "tif"),
    TIFF(8, "tiff"),
    JPEG(9, "jpeg"),
    BMP(10, "bmp"),
    ET(11, "et"),
    XLSX(12, "xlsx");

    @Getter
    private Integer code;

    @Getter
    private String name;

    FileTypeEnum(Integer code, String name) {
        this.code = code;
        this.name = name;
    }

    public static FileTypeEnum getEnum(Integer index) {
        FileTypeEnum[] statusEnums = FileTypeEnum.values();
        for (FileTypeEnum fileTypeEnum : statusEnums) {
            if (index.equals(fileTypeEnum.getCode())) {
                return fileTypeEnum;
            }
        }
        return null;
    }

}
